<template>
  <div class="app-container">
    <div class="searchBox">
      <el-form :inline="true">
        <el-form-item label="证书标题：">
          <el-input v-model="search.certTitle" placeholder="请输入内容"></el-input>
        </el-form-item>
        <el-form-item label="证书类型：">
          <el-select v-model="search.certType">
            <el-option value>请选择</el-option>
            <el-option
              v-for="item in controlData.osTypeOptions"
              :key="item.value"
              :value="item.value"
              :label="item.key"
            ></el-option>
          </el-select>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="searchQuery">查询</el-button>
          <el-button type="info" @click="search = {}; searchQuery();">重置</el-button>
        </el-form-item>
      </el-form>
    </div>

    <qm-table
      ref="qmTable"
      :data="query"
      keyProp="certId"
      :formValidate="defaultFormValidate"
      isCustomForm
      :showView="false"
    >
      <qm-table-column field="certTitle">证书标题</qm-table-column>
      <qm-table-column field="certType" sortable="true">证书类型</qm-table-column>
      <qm-table-column field="createdDate" width="120px" sortable="true" fieldtype="datetime">创建时间</qm-table-column>
      <qm-table-column field="updatedDate" width="120px" sortable="true" fieldtype="datetime">修改时间</qm-table-column>

      <template v-slot:form="{ models, controlData, pageAction }">
        <create
          ref="create"
          :models="models"
          :controlData="controlData"
          :pageAction="pageAction"
          :appId="appId"
        ></create>
      </template>
    </qm-table>
  </div>
</template>

<script>
import Controller from "@/libs/framework/controller";
import Create from "./create";
export default class Instance extends Controller {
  onBeforeInit() {
    this.urls = {
      model: "/mobile/mobileAppCertificate/getListModel",
      query: "/mobile/mobileAppCertificate/query",
      save: "/mobile/mobileAppCertificate/save",
      delete: "/mobile/mobileAppCertificate/delete",
      entity: "/mobile/mobileAppCertificate/getEntity",
    };
  }

  showLoading() {
    return false;
  }

  onBeforeQuery(type, conditions, params) {
    if (type === "list") {
      this.$util.extend(params.query, { appId: this.vm.appId });
    }
  }

  mixin() {
    return {
      components: {
        Create,
      },
      props: {
        appId: String,
      },
      data() {
        return {};
      },
      methods: {},
    };
  }
}
</script>

<style scoped lang="scss">
</style>
